<?php
session_start();
require ('../classes/Conf.php');
require ('../classes/ConnectionSecure.php');
include ('../validar_sesion.php');
if ($logueado) {
    switch ($rolUsuario['Rol']) {
        case '1': {
                header("Location:../index.php");
                break;
            }
    }
}
require ('../classes/Connection.php');
require ('../classes/Usuarios.php');
require ('../classes/Transacciones.php');
?>



<!DOCTYPE html>
<html class="no-js">
    <head>
        <meta charset="utf-8">
        <title>Historico de transacciones</title>
        <meta name="description" content="">
        <meta name="viewport" content="width=device-width">
        <meta name="author" content="templatemo">
        <link href='http://fonts.googleapis.com/css?family=Open+Sans:400,800,700,600,300' rel='stylesheet' type='text/css'>

        <link rel="stylesheet" href="../resources/css/bootstrap.min.css">
        <link rel="stylesheet" href="../resources/css/font-awesome.css">
        <link rel="stylesheet" href="../resources/css/animate.css">
        <link rel="stylesheet" href="../resources/css/templatemo_misc.css">
        <link rel="stylesheet" href="../resources/css/templatemo_style.css">



        <title>Cargue masivo de transacciones</title>
        <script type="text/javascript" src="../resources/js/jquery-1.10.2.min.js"></script>
        <script type="text/javascript" src="../resources/js/jquery.form.min.js"></script>

        <script type="text/javascript">
            $(document).ready(function() {
                var options = {
                    target: '#output',
                    beforeSubmit: beforeSubmit,
                    success: afterSuccess,
                    uploadProgress: OnProgress,
                    resetForm: true
                };

                $('#MyUploadForm').submit(function() {
                    $(this).ajaxSubmit(options);
                    return false;
                });



                function afterSuccess()
                {
                    $('#submit-btn').show(); //hide submit button
                    $('#loading-img').hide(); //hide submit button
                    $('#progressbox').delay(1000).fadeOut(); //hide progress bar

                }


                function beforeSubmit() {

                    if (window.File && window.FileReader && window.FileList && window.Blob)
                    {

                        if (!$('#FileInput').val())
                        {
                            $("#output").html("Are you kidding me?");
                            return false
                        }

                        var fsize = $('#FileInput')[0].files[0].size;
                        var ftype = $('#FileInput')[0].files[0].type;

                        switch (ftype)
                        {
                            case 'text/plain':
                                break;
                            default:
                                $("#output").html("<b>" + ftype + "</b> Formato de archivo incorrecto!");
                                return false
                        }
                        if (fsize > 5242880)
                        {
                            $("#output").html("<b>" + bytesToSize(fsize) + "</b>El archivo es demasiado grande! <br />El archivo debe ser menor a 5 MB.");
                            return false
                        }
                        $('#submit-btn').hide();
                        $('#loading-img').show();
                        $("#output").html("");
                    }
                    else
                    {
                        $("#output").html("Estas usando un navegador muy antiguo!");
                        return false;
                    }
                }

                function OnProgress(event, position, total, percentComplete)
                {
                    $('#progressbox').show();
                    $('#progressbar').width(percentComplete + '%')
                    $('#statustxt').html(percentComplete + '%');
                    if (percentComplete > 50)
                    {
                        $('#statustxt').css('color', '#000');
                    }
                }

                function bytesToSize(bytes) {
                    var sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB'];
                    if (bytes == 0)
                        return '0 Bytes';
                    var i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024)));
                    return Math.round(bytes / Math.pow(1024, i), 2) + ' ' + sizes[i];
                }

            });

        </script>
        <!--        <link href="../resources/style/style.css" rel="stylesheet" type="text/css">-->
    </head>
    <body>



        <div class="site-header">
            <div class="container">
                <div class="main-header">
                    <div class="row">
                        <div class="col-md-4 col-sm-6 col-xs-10">
                            <div class="logo">
                                <a rel="nofollow" href="http://www.templatemo.com/preview/templatemo_409_travel">
                                    <img src="../resources/images/logoBanqueaChevere.png" alt="travel by templatemo" title="travel - free html5 template">
                                </a>
                            </div> <!-- /.logo -->
                        </div> <!-- /.col-md-4 -->
                        <div class="col-md-8 col-sm-6 col-xs-2">
                            <div class="main-menu">
                                <ul class="visible-lg visible-md">
                                    <li><a href="../index.php">Home</a></li>
                                    <li><a href="historico.php">Historico</a></li>
                                    <li><a href="transaccion_formulario.php">Transacciones</a></li>                                    
                                    <li   class="active"><a href="cargueMasivo.php">C. Masivo</a></li>                                    
                                    <li><a href="../compresser/compress.php">D. Token</a></li>                                     
                                    <li><a href="../salir.php">Salir</a></li>                                    
                                </ul>
                                <a href="#" class="toggle-menu visible-sm visible-xs">
                                    <i class="fa fa-bars"></i>
                                </a>
                            </div> <!-- /.main-menu -->
                        </div> <!-- /.col-md-8 -->
                    </div> <!-- /.row -->
                </div> <!-- /.main-header -->
                <div class="row">
                    <div class="col-md-12 visible-sm visible-xs">
                        <div class="menu-responsive">
                            <ul>
                                <li><a href="../index.php">Home</a></li>
                                <li><a href="historico.php">Historico</a></li>
                                <li><a href="transaccion_formulario">Transacciones</a></li> 
                                <li   class="active"><a href="cargueMasivo.php">C. Masivo</a></li>                                    
                                <li><a href="../compresser/compress.php">D. Token</a></li>
                                <li><a href="../salir.php">Salir</a></li>                                    

                            </ul>
                        </div> <!-- /.menu-responsive -->
                    </div> <!-- /.col-md-12 -->
                </div> <!-- /.row -->
            </div> <!-- /.container -->
        </div> <!-- /.site-header -->

        <div class="page-top" id="templatemo_contact">
        </div> <!-- /.page-header -->

        <div class="contact-page">
            <div class="container">
                <div class="row">

                    <div class="col-md-5 col-sm-6">
                        <h3 class="widget-title">Transacciones</h3>
                        <div class="contact-form">



                            <div id="upload-wrapper">
                                <div align="center">
                                    <h3>Cargue masivo de transacciones</h3>
                                    <form action="processupload.php" method="post" enctype="multipart/form-data" id="MyUploadForm">
                                        <input name="FileInput" id="FileInput" type="file" required/>
                                        <input name="token"  type="text" <input name="FileInput" id="FileInput" placeholder="Token" type="file" />
                                        <input type="submit"  id="submit-btn" value="Procesar" />
                                        <img src="../resources/images/ajax-loader.gif" id="loading-img" style="display:none;" alt="Please Wait"/>
                                    </form>


                                    <div id="progressbox" ><div id="progressbar"></div ><div id="statustxt">0%</div></div>
                                    <div id="output"></div>
                                </div>
                            </div>

                        </div> <!-- /.contact-form -->
                    </div>
                </div>
            </div>
        </div>







        <div class="site-footer">
            <div class="container">
                <div class="row">
                    <div class="col-md-4 col-sm-4">
                        <div class="footer-logo">
                            <a href="index.html">
                                <img src="../resources/images/logoBanqueaChevere.png" alt="">
                            </a>
                        </div>
                    </div> <!-- /.col-md-4 -->
                    <div class="col-md-4 col-sm-4">
                        <div class="copyright">
                            <span>Copyright &copy; 2084 <a href="#">Company Name</a> - <a rel="nofollow" href="http://www.templatemo.com/preview/templatemo_409_travel">Travel</a> by <a rel="nofollow" href="http://www.templatemo.com">templatemo</a></span>
                        </div>
                    </div> <!-- /.col-md-4 -->
                    <div class="col-md-4 col-sm-4">
                        <ul class="social-icons">
                            <li><a href="#" class="fa fa-facebook"></a></li>
                            <li><a href="#" class="fa fa-twitter"></a></li>
                            <li><a href="#" class="fa fa-linkedin"></a></li>
                            <li><a href="#" class="fa fa-flickr"></a></li>
                            <li><a href="#" class="fa fa-rss"></a></li>
                        </ul>
                    </div> <!-- /.col-md-4 -->
                </div> <!-- /.row -->
            </div> <!-- /.container -->
        </div> <!-- /.site-footer -->        




    </body>
</html>


